package com.wen.model;


import com.wen.dao.DbProvider;
import com.wen.uilts.MyUilts;
import org.apache.commons.dbutils.handlers.MapListHandler;

import java.util.List;
import java.util.Map;

public class UserModel {

    public boolean doLogin(String userName, String userPsw){
        //默认返回值
        boolean canLogin = false;
        //查询语句
        String strSql = "select * from userInfo where username = ? and userpsw = ?";
        //创建查询器
       // DbProvider dbProvider = new DbProvider();
        //判断查询是否成功
        //List<Map<String,Object>> list = dbProvider.requryListMap(strSql, userName,userPsw);
        List<Map<String,Object>> list = MyUilts.getNewInstance(DbProvider.class).query(strSql, new MapListHandler(), userName, userPsw);
        if (list != null && list.size() > 0){
            canLogin = true;
        }
        return canLogin;
    }
}
